package com.pj.project4sp.name;


import com.pj.utils.sg.AjaxJson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
 * Controller: api请求记录表
 * @author kong 
 */
@RestController
@RequestMapping("/SgName/")
public class NameControlle {

	/** 底层 Mapper 对象 */
	@Autowired
	NameMapper spApilogMapper;


	/** 删 */
	@RequestMapping("delete")
//	@SaCheckPermission(AuthConst.APILOG_LIST)
	AjaxJson delete(String id){
		int line = spApilogMapper.delete(id);
		return AjaxJson.getByLine(line);
	}


	
	/** 查 - 集合（参数为null或0时默认忽略此条件）   */
	@RequestMapping("getList")
//	@SaCheckPermission(AuthConst.APILOG_LIST)
	Object getList() {
		List a = new ArrayList<>();
		List<Name> list = spApilogMapper.getList();
		for (Name name: list ) {
			a.add(name.getName());

		}

		return a.stream().map(Object::toString).collect(Collectors.joining(", "));
	}


}
